Re: 8lgm's SCO "at" hole

Casper Dik (casper@fwi.uva.nl)
Sat, 10 Dec 1994 14:22:16 +0100

>AFAIK, getcwd(3) always calls /bin/pwd; but getwd(2) is a system call.
>getcwd() is only provided for backwards compatibility; i suppose all new
>code should be using getwd(2).


Neither of the calls is a system call on any system that I'm aware of.
Getcwd(3) is the thing POSIX wants you to use.
Getwd() is to getcwd() what  gets() is to fgets() [ well, almost ].

When chosing between: getwd(char *buf) and getcwd(char *buf, size_t size_of_buf)
the choice should be obvious.

In SunOS 4.1.x, getcwd() does call /bin/pwd.
In Solaris 2.x, getcwd() use /etc/mnttab and some tree traversal
to find the current directory.  getwd is relegated to libucb.so and
just calls getcwd(buf, MAXPATHLEN);

Casper